# Maintainer: Lukas Fleischer <lfleischer@archlinux.org>
# Contributor: Felip Manyer i Ballester <archlinux at res hyphen telae dot cat>
# Contributor: Alex Ferrando <alferpal@gmail.com>
# Contributor: Zhang Li <richselian at gmail.com>

pkgname=vim-syntastic
_pkgname=syntastic
pkgver=3.10.0
pkgrel=3
pkgdesc='Automatic syntax checking for Vim'
arch=('any')
url='https://github.com/vim-syntastic/syntastic'
license=('custom:WTFPL')
depends=('vim-plugin-runtime')
groups=('vim-plugins')
source=("$pkgname-$pkgver.tar.gz::https://github.com/scrooloose/${_pkgname}/archive/${pkgver}.tar.gz")
sha256sums=('84d2ff8bb979bb85de0fd27bc3e746361eab63e560fac97c826054d94077318c')

package() {
    cd "${srcdir}/${_pkgname}-${pkgver}"

    install -d "${pkgdir}/usr/share/vim/vimfiles/"{plugin,doc,autoload/syntastic/,syntax_checkers}
    find . -type d -exec chmod 755 '{}' \;
    cp -dr plugin/* "$pkgdir/usr/share/vim/vimfiles/plugin/"
    install -Dm0644 -t "${pkgdir}/usr/share/vim/vimfiles/doc/" \
            doc/syntastic.txt \
            doc/syntastic-checkers.txt
    cp autoload/syntastic/* "$pkgdir/usr/share/vim/vimfiles/autoload/syntastic/"
    cp -dr syntax_checkers/* "$pkgdir/usr/share/vim/vimfiles/syntax_checkers/"

    # remove rustc checker (fixes FS#41517)
    rm -rf "${pkgdir}/usr/share/vim/vimfiles/syntax_checkers/rust/"

    # install license file
    install -Dm0644 LICENCE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
